package main

import (
	"fmt"
	"time"
)

func main() {
	now := time.Now()
	fmt.Printf("now: %v\n", now)
	fmt.Printf("now.Unix(): %v\n", now.Unix())

	fmt.Printf("now.Format(time.Layout): %v\n", now.Format(time.Layout))
	fmt.Printf("now.Format(time.ANSIC): %v\n", now.Format(time.ANSIC))
	fmt.Printf("now.Format(time.UnixDate): %v\n", now.Format(time.UnixDate))
	fmt.Printf("now.Format(time.RubyDate): %v\n", now.Format(time.RubyDate))
	fmt.Printf("now.Format(time.RFC822): %v\n", now.Format(time.RFC822))
	fmt.Printf("now.Format(time.RFC822Z): %v\n", now.Format(time.RFC822Z))
	fmt.Printf("now.Format(time.RFC850): %v\n", now.Format(time.RFC850))
	fmt.Printf("now.Format(time.RFC1123): %v\n", now.Format(time.RFC1123))
	fmt.Printf("now.Format(time.RFC1123Z): %v\n", now.Format(time.RFC1123Z))
	fmt.Printf("now.Format(time.RFC3339): %v\n", now.Format(time.RFC3339))
	fmt.Printf("now.Format(time.RFC3339Nano): %v\n", now.Format(time.RFC3339Nano))
	fmt.Printf("now.Format(time.Kitchen): %v\n", now.Format(time.Kitchen))
	fmt.Printf("now.Format(time.Stamp): %v\n", now.Format(time.Stamp))
	fmt.Printf("now.Format(time.StampMilli): %v\n", now.Format(time.StampMilli))
	fmt.Printf("now.Format(time.StampMicro): %v\n", now.Format(time.StampMicro))
	fmt.Printf("now.Format(time.StampNano): %v\n", now.Format(time.StampNano))

	fmt.Printf("now.Format(\"2006-01-02 15:04:05\"): %v\n", now.Format("2006-01-02 15:04:05"))
	fmt.Printf("now.Format(\"2006-01-02T15:04:05Z\"): %v\n", now.Format("2006-01-02T15:04:05Z"))

	time_string := now.Format("2006-01-02T15:04:05Z")
	t1, _ := time.Parse("2006-01-02T15:04:05Z", time_string)
	fmt.Printf("t1: %v\n", t1)
	fmt.Printf("t1.Unix(): %v\n", t1.Unix())
	t2, _ := time.ParseInLocation("2006-01-02T15:04:05Z", time_string, now.Location())
	fmt.Printf("t2: %v\n", t2)
	fmt.Printf("t2.Unix(): %v\n", t2.Unix())
	loc, _ := time.LoadLocation("Asia/Shanghai")
	t3, _ := time.ParseInLocation("2006-01-02T15:04:05Z", time_string, loc)
	fmt.Printf("t3: %v\n", t3)
	fmt.Printf("t3.Unix(): %v\n", t3.Unix())
}
